package com.mz.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.mz.base.util.ATTSystem;

public class LogoutServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		HttpSession session = request.getSession(true);
		session.removeAttribute(ATTSystem.KEY_SESSION_LOGIN);
		
		ATTSystem.MAP_SESSION_USERID.remove(session.getId());
		
		response.sendRedirect("/index.jsp");
	}
	
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		this.doPost(request, response);
	}

	public void init() throws ServletException {}
	
	public LogoutServlet() {
		super();
	}

	public void destroy() {
		super.destroy();
	}
}